package cn.thoughtworks.school.services;

import cn.thoughtworks.school.feign.UserCenterFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class PasswordResetService {

  @Autowired
  private UserCenterFeign userCenterFeign;

  public ResponseEntity cretePasswordResetEmail(Map<String,String> emailInfo) {
    Map result = new HashMap();
    ResponseEntity responseEntity = userCenterFeign.cretePasswordResetEmail(emailInfo);
    result.put("message", "邮件发送成功，请注意查收！");
    return new ResponseEntity(result, responseEntity.getStatusCode());
  }

  public ResponseEntity resetPassword(Map<String,String> passwordInfo) {
    Map result = new HashMap();
    ResponseEntity responseEntity = userCenterFeign.resetPassword(passwordInfo);
    result.put("message", "重置密码成功，请重新登录");
    return new ResponseEntity(result, responseEntity.getStatusCode());
  }
}